package com.css.zfzx.sjcj.modules.hddcGeomorphySvyRegion.repository;

import com.css.zfzx.sjcj.modules.hddcGeomorphySvyRegion.repository.entity.HddcGeomorphysvyregionEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author zyb
 * @date 2020-11-27
 */
public interface HddcGeomorphysvyregionRepository extends JpaRepository<HddcGeomorphysvyregionEntity, String> {


    @Query(nativeQuery = true, value = "select * from hddc_Geomorphysvyregion where project_name in :projectIds")
    List<HddcGeomorphysvyregionEntity> queryHddcGeomorphysvyregionsByProjectId(List<String> projectIds);


    @Query(nativeQuery = true, value = "select * from hddc_Geomorphysvyregion where is_valid = '1'")
    List<HddcGeomorphysvyregionEntity> findAll();


    @Query(nativeQuery = true, value = "select * from hddc_Geomorphysvyregion where task_name in :projectIds")
    List<HddcGeomorphysvyregionEntity> queryHddcGeomorphysvyregionsByTaskId(List<String> projectIds);

    @Query(nativeQuery = true, value = "select * from hddc_Geomorphysvyregion where create_user = :createID and province = :provinceName and city =:cityName and area =:areaName")
    List<HddcGeomorphysvyregionEntity> queryHddcGeomorphysvyregionByCreateuser(String createID,String provinceName,String cityName,String areaName);

    @Modifying
    @Query(nativeQuery = true, value = "update hddc_Geomorphysvyregion set is_valid = '0' where province = :provinceName and city =:cityName and area =:areaName and extends8 =:savefilename")
    void deleteFileData(String provinceName,String cityName,String areaName,String savefilename);
}
